<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>setInterval 的使用</title>
    <script src="../../../js/vue.global.js"></script>
</head>
<body>
<div id="clock"></div>

<script>
    let element = document.getElementById("clock");

    // let time = 0;


    setInterval(function () {
        // time++
        let time = new Date()
        console.log(time);
        element.innerText = time.toLocaleTimeString()
    }, 1000)

</script>

<!--<div id="clock">-->
<!--    {{ time.toLocaleTimeString() }}-->
<!--</div>-->

<!--<script>-->
<!--    setInterval(function () {-->
<!--        -->
<!--    }, 1000)-->
<!--    -->
<!--    const app = Vue.createApp({-->
<!--        data(){-->
<!--            return {-->
<!--                time: new Date(),-->
<!--            }-->
<!--        }-->
<!--    })-->

<!--    app.mount("#clock")-->
<!--</script>-->
</body>
</html>